import CryptoJS from 'crypto-js'
import 'md5.js'

export function encodeMD5(msg) {
  return CryptoJS.MD5(msg).toString()
}

export function encodeAES(msg, key) {
  return CryptoJS.AES.encrypt(msg, key).toString()
}

export function decodeAES(msg, key) {
  const bytes = CryptoJS.AES.decrypt(msg, key)
  return bytes.toString(CryptoJS.enc.Utf8)
}
